package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
//model layer package has to be imported
/**
 * Controller class for the DVD collection
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * @revised version English (Ab)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class DVDCtr
{
    private DVDCollection dvdC;
    
    /**
     * the constructor of the class
     */
    public DVDCtr()//DVD container is to be passed as parameter from the main controller
    {
        dvdC = new DVDCollection();  
    }
    
    /**
     * a DVD is searched for and then returned
     * @param title
     * @return title
     */
    public DVD findDVD(String title)
    {
        return dvdC.findDVD(title);
    }
    
    /**
     * this methods makes it possible to create a DVD from the U layer
     * @param id, title, publisher releaseYear
     */
    public void createDVD(int ID, String title, String publisher, String releaseYear)
    {       
          DVD dvd = new DVD(ID, title, publisher, releaseYear);
          dvdC.addDVD(dvd);
    }
    
    /**
     * this method deletes a dvd but not a certain one
     * @param title
     */
    public void deleteDVD(String title)
    {   
        
        dvdC.deleteDVD(title);
       
    }
    
    /**
     * this method creates a copy and is used in the UIlayer
     * @param id serialNo, purchaseDate purchasePrice
     */
//     this method doesnt work as it cant find the createCopy method. 
//     the group could not find the error as the method does exist
    public void createCopy(int ID, String serialNo, String purchaseDate, String purchasePrice)
    {
        dvdC.createCopy(ID, serialNo, purchaseDate, purchasePrice);
    }
    
    /**
     * this method return the list of all DVD's 
     * @return dvd
     */
    public ArrayList<DVD> listAllDvds()
    {
          ArrayList<DVD> dvd = dvdC.listAllDVDs();
          return dvd;
    }
}
